package com.cloud.code.牛客网;

public class Test24 {

    public static void main(String[] args) {
        plusOne(new int[]{9,9});
    }

    public static int[] plusOne(int[] digits) {

        for (int i = digits.length-1; i >= 0; i--) {
            digits[i] = (digits[i]+1)%10;
            if(digits[i] != 0){
                return digits;
            }
        }

        digits = new int[digits.length +1];

        digits[0] = 1;

        return digits;

    }
}
